Optimal. Leaf size=192 \[ a^2 (3 A b+a B) x+\frac {\left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 (2 A+C)\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}+\frac {b \left (9 a b B-a^2 (6 A-8 C)+b^2 (3 A+2 C)\right ) \tan (c+d x)}{3 d}-\frac {b^2 (6 a A-3 b B-5 a C) \sec (c+d x) \tan (c+d x)}{6 d}-\frac {b (3 A-C) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.26, antiderivative size = 192, normalized size of antiderivative = 1.00, number of steps
used = 7, number of rules used = 6, integrand size = 39, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.154, Rules used = {4179, 4141,
4133, 3855, 3852, 8} \begin {gather*} \frac {b \tan (c+d x) \left (-\left (a^2 (6 A-8 C)\right )+9 a b B+b^2 (3 A+2 C)\right )}{3 d}+a^2 x (a B+3 A b)+\frac {\left (2 a^3 C+6 a^2 b B+3 a b^2 (2 A+C)+b^3 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}-\frac {b^2 \tan (c+d x) \sec (c+d x) (6 a A-5 a C-3 b B)}{6 d}-\frac {b (3 A-C) \tan (c+d x) (a+b \sec (c+d x))^2}{3 d}+\frac {A \sin (c+d x) (a+b \sec (c+d x))^3}{d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 4133
Rule 4141
Rule 4179
Rubi steps
\begin {align*} \int \cos (c+d x) (a+b \sec (c+d x))^3 \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx &=\frac {A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}+\int (a+b \sec (c+d x))^2 \left (3 A b+a B+(b B+a C) \sec (c+d x)-b (3 A-C) \sec ^2(c+d x)\right ) \, dx\\ &=\frac {A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}-\frac {b (3 A-C) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{3} \int (a+b \sec (c+d x)) \left (3 a (3 A b+a B)+\left (3 A b^2+6 a b B+3 a^2 C+2 b^2 C\right ) \sec (c+d x)-b (6 a A-3 b B-5 a C) \sec ^2(c+d x)\right ) \, dx\\ &=\frac {A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}-\frac {b^2 (6 a A-3 b B-5 a C) \sec (c+d x) \tan (c+d x)}{6 d}-\frac {b (3 A-C) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{6} \int \left (6 a^2 (3 A b+a B)+3 \left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 (2 A+C)\right ) \sec (c+d x)+2 b \left (9 a b B-a^2 (6 A-8 C)+b^2 (3 A+2 C)\right ) \sec ^2(c+d x)\right ) \, dx\\ &=a^2 (3 A b+a B) x+\frac {A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}-\frac {b^2 (6 a A-3 b B-5 a C) \sec (c+d x) \tan (c+d x)}{6 d}-\frac {b (3 A-C) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}+\frac {1}{2} \left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 (2 A+C)\right ) \int \sec (c+d x) \, dx+\frac {1}{3} \left (b \left (9 a b B-a^2 (6 A-8 C)+b^2 (3 A+2 C)\right )\right ) \int \sec ^2(c+d x) \, dx\\ &=a^2 (3 A b+a B) x+\frac {\left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 (2 A+C)\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}-\frac {b^2 (6 a A-3 b B-5 a C) \sec (c+d x) \tan (c+d x)}{6 d}-\frac {b (3 A-C) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}-\frac {\left (b \left (9 a b B-a^2 (6 A-8 C)+b^2 (3 A+2 C)\right )\right ) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{3 d}\\ &=a^2 (3 A b+a B) x+\frac {\left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 (2 A+C)\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {A (a+b \sec (c+d x))^3 \sin (c+d x)}{d}+\frac {b \left (9 a b B-a^2 (6 A-8 C)+b^2 (3 A+2 C)\right ) \tan (c+d x)}{3 d}-\frac {b^2 (6 a A-3 b B-5 a C) \sec (c+d x) \tan (c+d x)}{6 d}-\frac {b (3 A-C) (a+b \sec (c+d x))^2 \tan (c+d x)}{3 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(509\) vs. \(2(192)=384\).
time = 6.35, size = 509, normalized size = 2.65 \begin {gather*} \frac {\cos ^5(c+d x) (a+b \sec (c+d x))^3 \left (A+B \sec (c+d x)+C \sec ^2(c+d x)\right ) \left (12 a^2 (3 A b+a B) (c+d x)-6 \left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 (2 A+C)\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )+6 \left (6 a^2 b B+b^3 B+2 a^3 C+3 a b^2 (2 A+C)\right ) \log \left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )+\frac {b^2 (9 a C+b (3 B+C))}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {2 b^3 C \sin \left (\frac {1}{2} (c+d x)\right )}{\left (\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )\right )^3}+\frac {4 b \left (3 A b^2+9 a b B+9 a^2 C+2 b^2 C\right ) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )-\sin \left (\frac {1}{2} (c+d x)\right )}+\frac {2 b^3 C \sin \left (\frac {1}{2} (c+d x)\right )}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^3}-\frac {b^2 (9 a C+b (3 B+C))}{\left (\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )\right )^2}+\frac {4 b \left (3 A b^2+9 a b B+9 a^2 C+2 b^2 C\right ) \sin \left (\frac {1}{2} (c+d x)\right )}{\cos \left (\frac {1}{2} (c+d x)\right )+\sin \left (\frac {1}{2} (c+d x)\right )}+12 a^3 A \sin (c+d x)\right )}{6 d (b+a \cos (c+d x))^3 (A+2 C+2 B \cos (c+d x)+A \cos (2 (c+d x)))} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.13, size = 235, normalized size = 1.22 Too large to display
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.30, size = 280, normalized size = 1.46 \begin {gather*} \frac {12 \, {\left (d x + c\right )} B a^{3} + 36 \, {\left (d x + c\right )} A a^{2} b + 4 \, {\left (\tan \left (d x + c\right )^{3} + 3 \, \tan \left (d x + c\right )\right )} C b^{3} - 9 \, C a b^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} - 3 \, B b^{3} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 6 \, C a^{3} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 18 \, B a^{2} b {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 18 \, A a b^{2} {\left (\log \left (\sin \left (d x + c\right ) + 1\right ) - \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 12 \, A a^{3} \sin \left (d x + c\right ) + 36 \, C a^{2} b \tan \left (d x + c\right ) + 36 \, B a b^{2} \tan \left (d x + c\right ) + 12 \, A b^{3} \tan \left (d x + c\right )}{12 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 2.91, size = 225, normalized size = 1.17 \begin {gather*} \frac {12 \, {\left (B a^{3} + 3 \, A a^{2} b\right )} d x \cos \left (d x + c\right )^{3} + 3 \, {\left (2 \, C a^{3} + 6 \, B a^{2} b + 3 \, {\left (2 \, A + C\right )} a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )^{3} \log \left (\sin \left (d x + c\right ) + 1\right ) - 3 \, {\left (2 \, C a^{3} + 6 \, B a^{2} b + 3 \, {\left (2 \, A + C\right )} a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )^{3} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (6 \, A a^{3} \cos \left (d x + c\right )^{3} + 2 \, C b^{3} + 2 \, {\left (9 \, C a^{2} b + 9 \, B a b^{2} + {\left (3 \, A + 2 \, C\right )} b^{3}\right )} \cos \left (d x + c\right )^{2} + 3 \, {\left (3 \, C a b^{2} + B b^{3}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{12 \, d \cos \left (d x + c\right )^{3}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a + b \sec {\left (c + d x \right )}\right )^{3} \left (A + B \sec {\left (c + d x \right )} + C \sec ^{2}{\left (c + d x \right )}\right ) \cos {\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 438 vs.
\(2 (185) = 370\).
time = 0.55, size = 438, normalized size = 2.28 \begin {gather*} \frac {\frac {12 \, A a^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} + 1} + 6 \, {\left (B a^{3} + 3 \, A a^{2} b\right )} {\left (d x + c\right )} + 3 \, {\left (2 \, C a^{3} + 6 \, B a^{2} b + 6 \, A a b^{2} + 3 \, C a b^{2} + B b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - 3 \, {\left (2 \, C a^{3} + 6 \, B a^{2} b + 6 \, A a b^{2} + 3 \, C a b^{2} + B b^{3}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (18 \, C a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 18 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 9 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 3 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} + 6 \, C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{5} - 36 \, C a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 36 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 12 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 18 \, C a^{2} b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 18 \, B a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 9 \, C a b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, A b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 3 \, B b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 6 \, C b^{3} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{3}}}{6 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 6.49, size = 2437, normalized size = 12.69 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________